<?php
class product_Model  extends MY_Model {
	function __construct() {
		parent::__construct();	
	}
	function table(){
		return "products";
	}	
	function attribute(){
		return array("primary"=>"id");
	}

	function getListImage($id) {
		$this->db->where('productId', $id);
		$query = $this->db->get('pro_images');
        return $query->result();
	}

	function getListSimilar($catId, $productId) {
		$sql = "select * from products where productId <> '$productId' and catId = $catId order by rand() limit 4";
		$query = $this->db->query($sql);
        return $query->result();
	}
}